﻿using System;
using System.Diagnostics;

namespace Genesis.Infrastructure
{
    
    public static class Logic
    {

        public static bool UseTraceAssert { get; set; }

        public static void Check(bool condition, string message)
        {

            if (UseTraceAssert)
                Trace.Assert(condition, message);
            else
                if (!condition)
                    throw new LogicException(message);

        }

        public static void Check(bool condition, string message, Exception inner)
        {

            if (UseTraceAssert)
                Trace.Assert(condition, message);
            else
                if (!condition)
                    throw new LogicException(message, inner);

        }

    }

}